//
//  NSString+Lc.h
//  18Birdies
//
//  Created by Lc on 15/3/20.
//  Copyright (c) 2015年 Lc. All rights reserved.
//

#import <UIKit/UIKit.h>

@class LcFont;

typedef enum {
  RandomStringTypeNumbers,
  RandomStringTypeLetters,
  RandomStringTypeNumbersAndLetters,
  RandomStringTypeNormalCharacter,
  RandomStringTypeAllAsc2,
} RandomStringType;

@interface NSString (Lc)

- (BOOL)isValidPhoneNumber;

- (BOOL)contains:(NSString*)string;
- (BOOL)containsIgnoreCase:(NSString*)string;

// use UTF-8 encoding by default
+ (NSString*)stringWithData:(NSData*)data;
- (NSData*)toData;

+ (NSString*)stringForKey:(NSString*)key table:(NSString*)table;

// only get first line width
- (float)widthWithLcFont:(LcFont*)lcFont;
- (float)heightOfFont:(UIFont*)font andWidth:(float)width;
- (CGSize)sizeOfFont:(UIFont*)font andWidth:(float)width;

- (NSString*)trim;
- (NSString*)remove:(NSString*)subString;

- (NSString*)numberString;

- (BOOL)isStartWithLetter;

- (NSString*)shortDisplayNameFormat;

- (NSString*)uppercaseFirstCharacter;
- (NSString*)lowercaseFirstCharacter;

// @"xxx..."
- (NSString*)formatEllipsisWithLengthLimit:(int)lengthLimit;
- (NSString*)formatEllipsisWithWidthLimit:(float)widthLimit lcFont:(LcFont*)lcFont;

// append "\n"
- (NSString*)appendNextLineString:(NSString*)string;
// each string appen "\n"
- (NSString*)appendNextLineStrings:(NSArray<NSString*>*)strings;

+ (NSString*)stringFromInt:(NSInteger)integer;
+ (NSString*)stringFromLongLong:(long long)integer;
- (NSString *)subToIndex:(NSInteger)index;

+ (instancetype)randomStringWithLength:(int)length type:(RandomStringType)type;

- (NSString*)urlEncode;
- (NSString*)urlQueryParamEncode;

- (NSURL*)toFullUrl;

@end
